package javaCode.chapter09.codeblock_;

public class CodeBlockExercise02 {
    public static void main(String[] args) {
        new Test();
    }
}

class Sample {
    Sample(String s) { //2 5
        System.out.println(s);
    }

    Sample() {
        System.out.println("Sample默认构造函数被调用");
    }
}

class Test {
    Sample sam1 = new Sample("sam1成员初始化"); //4
    static Sample sam = new Sample("静态成员sam初始化"); //1

    static { //3
        System.out.println("static块执行");
        if (sam == null) System.out.println("sam is null");
    }

    Test() {
        System.out.println("Test默认构造函数被调用"); //6
    }
}